package cn.maxhou.service.impl;

import cn.maxhou.entity.Auction;
import cn.maxhou.mapper.AuctionMapper;
import cn.maxhou.service.AuctionService;
import cn.maxhou.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.Collections;
import java.util.List;

public class AuctionServiceImpl implements AuctionService {
    public static SqlSession sqlSession = MyBatisUtil.createSqlSession();
    public static AuctionMapper auctionMapper = sqlSession.getMapper(AuctionMapper.class);
    @Override
    public List<Auction> getAuctionList() {
        return auctionMapper.getAuctionList();
    }

    @Override
    public List<Auction> searchAuctionList(Auction auction) {
        return auctionMapper.searchAuctionList(auction);
    }

    @Override
    public int deleteAuction(int auctionId) {
        int i = auctionMapper.deleteAuction(auctionId);
        sqlSession.commit();
        return i;
    }

    @Override
    public int insertAuction(Auction auction) {
        return 0;
    }

    @Override
    public Auction getAuctionById(int auctionId) {
        return auctionMapper.getAuctionById(auctionId);
    }
}
